package com.jiyun.service;

import com.jiyun.dao.CityMapper;
import com.jiyun.dao.DeptMapper;
import com.jiyun.dao.EmpMapper;
import com.jiyun.dao.EmpVoMapper;
import com.jiyun.pojo.City;
import com.jiyun.pojo.Dept;
import com.jiyun.pojo.Emp;
import com.jiyun.pojo.EmpVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmpService {
    @Autowired
    EmpVoMapper empMapper;
    @Autowired
    DeptMapper deptMapper;
    @Autowired
    CityMapper cityMapper;
    @Autowired
    EmpMapper e;

    public List<EmpVo> findAll(){
        return empMapper.findAll();
    }
    public void add(Emp emp){
        e.insert(emp);
    }
    public List<Dept> deptList(){
        return deptMapper.selectAll();
    }
    public List<City> cityList(){
        return cityMapper.selectAll();
    }
    public void delEmp(Integer eid){
        e.deleteByPrimaryKey(eid);
    }
    public void updateEmp(Emp emp){
        e.updateByPrimaryKeySelective(emp);
    }


}
